<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="uct" uri="/WEB-INF/uct.tld" %>
<%@ taglib prefix="portal" uri="/WEB-INF/portal.tld" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <%@ include file="/common/sale/include/common-base.jsp"%>
  <script type="text/javascript" src="${ctx}/js/tools-upload.js"></script>
  <title>风控规则设置-${titleName}</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
</head>




<!-- 以下是body主体内容的模块区域 -->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  <!-- top start -->
  <%@include file="/common/sale/top.jsp" %>
  <!-- top end -->
  <!-- left start -->
  <%@include file="/common/sale/left.jsp" %>
  <!-- left end-->

  <div class="content-wrapper">
    <!-- Main start -->
	<section class="content">
      <div class="row">
        <div class="col-xs-12">
        
          <!------搜索  start ------->
          <div class="box box-info" style="display: none">
             <!--搜索title  start --> 
	          <!-- <div class="box-header with-border">
                 
                 <div class="box-tools pull-right" style="display: none;">
	                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
	                </button>
	                <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                 </div>
              </div> -->
            <!--搜索title  end --> 
            <div class="box-body" style="display: none;">
			  <form id="searchForm" class="form-horizontal">
				<input type="hidden" name="doCode" value="dymicSql"/>
				<input type="hidden" name="modelTypes" value="s_trpProduct">
				<input type="hidden" name="trpProduct.w_delStatus" value="F">
				<input type="hidden" name="trpProduct.w_cateNo" value="bjtesale"/>
				<input type="hidden" name="orderBy"  value="trpProduct.create_time desc" />
			<!-- 	
			 <div class="col-sm-11">
				<div class="form-group">
					<div class="col-sm-2 text_r"><label class="control-label" >产品代码：</label></div>
					<div class="col-sm-2">
						<input type="text" class="form-control clean"  name="trpProduct.wl_proNo" value="" id="search_proNo"/>
					</div>
					<div class="col-sm-2 text_r"><label class="control-label" >成交号：</label></div>
					<div class="col-sm-2">
						<input type="text" class="form-control clean"  name="trpProduct.wl_proName" value="" id="search_proName"/>
					</div>
					
				</div>
				
			  </div>-->
			  
			  </form> 
            </div>
	     </div>
	     <!------- 搜索 end -------->
           
        <!------- 列表 start -------->
          <div class="box box-success">
            <!--列表title  start --> 
	          <div class="box-header with-border">
	         
                 <h3 class="box-title"><i class="fa fa-user"></i> 风控规则设置
                 	
                 </h3>
                 <div class="box-tools pull-right" style="display: none;">
	                 　　　　　　　　<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
	                </button>
	                <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                 </div>
              </div>
            <!--列表title  end --> 
              <div class="box-body">
                <table id="dataList" class="table table-bordered table-hover" >
                <thead class="bg-success">
                <tr>
                        
                        <th class="text_c">序号</th>
                        <th class="text_c">规则类型</th>
                        <th class="text_c">规则名称</th>
                        <th class="text_c">参数值</th>
                        <th class="text_c">备注说明(单位)</th>
                        <th class="text_c">操作</th>
                </tr>
               
                </thead>
                
                <tbody id="dataList-body" class="  ">
		           <script type="text/template" id="dataList-template">
			
				<tr>
					<td class="text_c">1</td>
					<td class="text_c"><input id="t1" class="form-control" readonly="readonly" value="监控结果通知对象"/></td>
					<td class="text_c"><input id="t2" class="form-control" readonly="readonly" value="通知对象邮箱"/></td>
					<td class="text_c"><input id="t3" class="form-control"readonly="readonly" value="<?=2*(i+1)?>.00"/></td>
					<td class="text_c"><input id="t4" class="form-control" readonly="readonly"  value="规则值：是指接受风险监控结果的业务管理员Email地址"/></td>
					<td class="text_c">
						<button id="but1" onclick="clickOk(this)" class="btn btn-success" type="button"><i class="btn btn-warning btn-xs"></i>修改</button>
					</td>
							  
				</tr>
				<tr>
					<td class="text_c">2</td>
					<td class="text_c"><input id="t5" class="form-control" readonly="readonly" value="密集交易监控"/></td>danger
					<td class="text_c"><input id="t6" class="form-control" readonly="readonly" value="次数阈值"/></td>
					<td class="text_c"><input id="t7" class="form-control" readonly="readonly" value="50"/></td>
					<td class="text_c"><input id="t8" class="form-control" readonly="readonly" value="单位：吨"/></td>
					<td class="text_c"><button id="but3" onclick="clickOk(this)" class="btn btn-success" type="button"><i class="btn btn-warning btn-xs"></i>修改</button>
					</td>
					
				</tr>
				<tr>
					<td class="text_c">3</td>
					<td class="text_c"><input id="t9" class="form-control" readonly="readonly" value="密集成交监控"/></td>
					<td class="text_c"><input id="t10" class="form-control" readonly="readonly" value="监控周期"</td>
					<td class="text_c"><input id="t11" class="form-control" readonly="readonly" value="40"/></td>
					<td class="text_c"><input id="t12" class="form-control" readonly="readonly" value="单位：次"/></td>
					<td class="text_c"><button id="but5" onclick="clickOk(this)" class="btn btn-success" type="button"><i class="btn btn-warning btn-xs"></i>修改</button>
					</td>
				</tr>
				<tr>
					<td class="text_c">4</td>
					<td class="text_c"><input id="t13"  class="form-control" readonly="readonly" value="关了账户监控"/></td>
					<td class="text_c"><input id="t14"  class="form-control" readonly="readonly" value="全额阈值"/></td>
					<td class="text_c"><input id="t15"  class="form-control" readonly="readonly" value="30"/></td>
					<td class="text_c"><input id="t16 "  class="form-control" readonly="readonly" value="单位：天"/></td>
					<td class="text_c">
					<span name="e" class="edit">
					<button id="but7" onclick="clickOk(this)" class="btn btn-success" type="button"><i class="btn btn-warning btn-xs"></i>修改</button>
					</span>
					</td>
					</tr>
   		
</script>
                
                </tbody>
              </table>
           <!--    <center>
    	  		<ul id="dataList-page"></ul>
              </center> -->
            </div>
           </div>
        <!------- 列表 end -------->
        </div>
      </div>
    </section>
    <!-- Main end -->
  </div>
  <!-- /.content-wrapper -->
  <!-- foot start -->
  <%@include file="/common/product/foot.jsp" %>
  <!-- foot start -->

<div class="modal fade" id="my_modal_add" tabindex="-1" data-backdrop="static" data-keyboard="false" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width: 800px">
				<div class="modal-content" >
					<div class="modal-header" >
						<button type="button" class="close"  data-dismiss="modal" aria-hidden="true" >
							×
						</button>
						<h4 class="modal-title">
							<font color="red">商品信息添加</font> 
						</h4>
					</div>

					<div class="modal-body">
						
					       <div class="nav-tabs-custom">
					            <ul class="nav nav-tabs" id="myTab">
					            </ul>
					            
					            <!-- tab content start -->
					            <div class="tab-content">
					            
					                  
					               <div class="tab-pane active" id="tab_1">
					               </div>
					          
				            </div>
					            <!-- tab content e -->
				          </div>	
			                
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>  

<div class="modal fade" id="my_modal_edit" tabindex="-1" data-backdrop="static" data-keyboard="false" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width: 800px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true" >
							×
						</button>
						<h4 class="modal-title">
							<font color="red">商品信息修改</font> 
						</h4>
					</div>
					<div class="modal-body">
						<div class="nav-tabs-custom">
					            <ul class="nav nav-tabs" id="myTab">
					            </ul>
					            
					            <!-- tab content start -->
					            <div class="tab-content">
					            
					                  
					               <div class="tab-pane active" id="edit_tab_1">
					               </div>
					          
				            </div>
					            <!-- tab content e -->
				          </div>	
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>  

<div win-title="查看窗口" class="modal fade" id="my_modal_view" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width: 800px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							×
						</button>
						<h4 class="modal-title">
							<font color="red">商品信息查看</font> 
						</h4>
					</div>
					<div class="modal-body" style="text-align: center;">
						<div class="nav-tabs-custom">
					            <ul class="nav nav-tabs" id="viewmyTab">
					            </ul>
					            
					            <!-- tab content start -->
					            <div class="tab-content">
					                  
					               <div class="tab-pane active" id="view_tab_1">
					                  
					               </div>
					          
				            </div>
					            <!-- tab content e -->
				          </div>	
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>
</body>


<!-- 以下是template列表模板的模块区域 -->
<script type="text/template" id="dataList-template">
			



		
  		
</script>

</html>



<!-- 以下是js模块区域 -->
<script>
 function clickOk(m){
	if(undefined==$(m).parents("tr").find("input:first").attr("readonly")){
		$(m).parents("tr").find("input").each(function(index,v){
			$(v).attr("readonly","readonly");
			$(m).parents("tr").find("button").html("<i class='btn btn-warning btn-xs'></i>修改");
			$(m).parents("tr").find("button").attr("class","btn btn-success");
		});
	}else{
		$(m).parents("tr").find("button").html("<i class='btn btn-warning btn-xs '></i>保存");
		$(m).parents("tr").find("button").attr("class","btn btn-danger");
		$(m).parents("tr").find("input").removeAttr("readonly");
	}
} 

/* (function(){
	$("#t1,#t2,#t3,#t4,#t5,#t6,#t7,#t8").attr("readonly", "readonly");
	$("$but2").hide();
});
function clickOk(m){
	for ( var i = 1; i <=4; i++) {
		$("#t"+m+""+i).removeAttr("readonly");
	}
	$("$but2").show();
	$("$but1").hide();
} */





var clickMenu = "riskcontrolrules";
var id,myPage,dataListId,searchFormId,isShowLog,tableSort,tableId;
myPage = 5;
dataListId = "dataList";
searchFormId = "searchForm";
tableSort = "trpProduct";
tableId = "proId";
isShowLog = true;

$(function () {
	//1、加载分页列表数据
	getTableData();
	//2、控制是否启用token
	//setToken();
	
	
	//请在下面补充其他初始化方法（如数据字典、页面加载数据等）
	//3、初始化数据字典
 });
 
var dateObject = $('.datepicker').datepicker( {
	language : 'zh-CN',
	//inline: true,
	todayBtn : "linked",
	format : "yyyy-mm-dd",
	autoclose: true
});
//toLoad1 读取（查询、编辑）数据
function toLoad1(id,type){
	var paramLoadData = {"formName":"searchForm1","pageName":"bjtesale-reg-list.jsp","trpProduct.w_proId":id};
	showModal(type);
	$.ajax({
	    type:'get',
	   	url:common_info_url+"?doCode=dymicSql",
	    data: paramLoadData,
	    async:false,
	    dataType:"json",
	    success: function(myData){
	    	console.log(myData);
	    	
			//FormUtil.loadView("trpProduct", myData.trpProduct);
			FormUtil.loadView("trpProduct", myData);
			DictUtil.getCommonDictData("select","#editForm1_trpProduct_proStatus","trpProduct.proStatus","doCode=dictItemList&cateEname=proStatus","",myData.trpProduct.proStatus);
			 
	  	}
	});
}

function toDele(id){
	var index_submit = layer.confirm('您确定要删除信息吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		var paramLoadData = {"modelTypes":"d_trpProduct","trpProduct.w_proId":id};
		//var paramLoadData = {"modelTypes":"u_trpProduct","trpProduct.delStatus":"T","trpProduct.w_proId":id};
		doDele(paramLoadData);
	});
}
//弹框
function showModal(type){
	if("view"==type){
		$("#my_modal_view").modal("show");
	}else if("edit"==type){
		//修改弹框时，初始化数据字典
		cleanData('editForm1');
		setValidate("editForm1");//2.校验规则-弹框窗口加载定义方法
		DictUtil.getCommonDictData("select","#editForm1_trpProduct_proStatus","trpProduct.proStatus","doCode=dictItemList&cateEname=proStatus","","");
		$("#my_modal_edit").modal("show");
	}
}

//$(function () {
	//$('#'+dataListId+' tbody').on('click','tr', function (e) {
	    // if ( $(this).hasClass('selected') ) {
	            //$(this).removeClass('selected');
	    //    }
	      //  else {
	        //    $('tr.selected').removeClass('selected');
	        //    $(this).addClass('selected');
	     //  }
	    // id = $('tr.selected td').eq(0).html();
	   //  console.log($('tr.selected td').eq(1).html())
	//} );
	
	
  //});
//加载列表数据
function getTableData(){
	
	deleteAllRow(dataListId);
	$.ajax({
		   type:'get',
		   url:common_list_url,
		   data:$("#"+searchFormId).serialize()+getCurrentPage(common_list_url+"?"+$("#"+searchFormId).serialize(),myPage),
		   dataType:'json',
		   success: function(myData){
		   if(isShowLog)console.log(myData);
			var data = baidu.template(dataListId+"-template",eval(myData));  
			$("#"+dataListId+"-body").html(data);
			  var option= {
					   ele:$("#"+dataListId+"-page")[0],
					   total:myData.total,
					   fn:getTableData,
					   url:common_list_url+"?"+$("#"+searchFormId).serialize()
				   }
				generatePages(option);
		   }
		});	
  }

//设置模态框隐藏事件 
$( '#my_modal_add' ).on( 'show.bs.modal' ,function(e){  
	setToken();
	cleanJiaoyan("addForm1");
	$("#addForm1_proNo").nextAll("span").remove();
});
//修改窗口，点击空白处校验未清空，设置修改窗口再次打开时清空校验
$( '#my_modal_edit' ).on( 'show.bs.modal' ,function(e){  
	setToken();
	cleanJiaoyan("editForm1");
}); 
//清空数据
function cleanData(id){
	$('#'+id).find(".clean").val("");//按照样式清空；
}


//获取对象值
function loadObj(type,paramData){
	$.ajax({
	    type:'get',
	   	url:common_info_url+"?doCode=dymicSql",
	    data: paramData,
	    async:false,
	    dataType:"json",
	    success: function(myData){
	    	showData(type,myData);
	  	}
	});	
}





</script>